<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			function add(a,b){
				return a+b;
			}
			//document.write(add(3,5));
			//var x=10;
			//var y=20;
			//var z=add(x,y);
			//document.write(z);
			//document.write(add(3*5,60-20));
			
			function add2(a=10,b=20){
				return a+b;
			}
			document.write(add2(100,200));
			document.write(add2());
			
			function addAll(){
				console.log("addAll()");
				for(i=0;arguments.length;i++){
					console.log(arguments[i]);
				}
			}
			addAll();
			addAll(10,20,30);
			
			//返回值
			function add3(a,b){
				var result=a+b;
				console.log(result);
				return result;
			}
			console.log(add3(100,300));
			var result=add3(1000,3000);
			var result2=add3(1,2)+add3(3,4);
			console.log(result);
		</script>
	</body>
</html>
